package cabbage.xxx;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import cabbage.beans.CollectedBean;
import cabbage.beans.InventoryBean;

public class InventoryBeanFactory {
	
	public InventoryBeanFactory() {
		
	}
	
	public List<InventoryBean> makeInventoryBeans(ResultSet resultSet) throws SQLException {
		List<InventoryBean> il = new ArrayList<InventoryBean>();
		
		while (resultSet.next()) {
			int playerid = resultSet.getInt("c.player_id");
			int livecollectibleid = resultSet.getInt("c.livecollectible_id");
			int locationid = resultSet.getInt("lc.location_id");
			int value = resultSet.getInt("cc.value");
			String name = resultSet.getString("cm.name");
			String description = resultSet.getString("cm.description");
			String imagefilename = resultSet.getString("cm.imagefilename");
			int collectiblecategoryid = resultSet.getInt("cm.collectiblecategory_id");
			String collectiblecategoryname = resultSet.getString("cc.name");
			
			InventoryBean b = new InventoryBean(playerid, livecollectibleid, locationid, value, name, 
					description, imagefilename, collectiblecategoryid, collectiblecategoryname);
			
			il.add(b);
		}
		
		return il;
		
	}

}
